<template>
  <div>
    <h1>物料管理</h1>
    <MasterTable :dataList="items" :columns="columns" />
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { fetchItems } from '@/api/master';
import MasterTable from '@/components/MasterTable.vue';

const items = ref([]);
const columns = [
  { label: 'ID', field: 'id' },
  { label: '物料编码', field: 'itemCode' },
  { label: '物料名称', field: 'itemName' },
  { label: '描述', field: 'itemDesc' },
  { label: '单位', field: 'uomName' },
  { label: '分类1', field: 'cat1Name' },
  { label: '分类2', field: 'cat2Name' },
  { label: '分类3', field: 'cat3Name' }
];
onMounted(async () => {
  items.value = await fetchItems();
});
</script> 